package com.print;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Printer {
    private Paper paper=null;
    private  Ink ink=null;

    public Printer() {
        System.out.println("打印机已构造~");
        System.out.println("Printer构造时间："+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()));
    }

    public void setPaper(Paper paper) {
        this.paper = paper;
    }

    public void setInk(Ink ink) {
        this.ink = ink;
    }

    public void print(String str){
        System.out.println("使用"+ink.getColor()+"打印……");
        paper.print(str);
    }
}
